﻿using System;
using System.Collections.Generic;
using Eamon.MeituanDotnetSDK.@enum;

namespace Eamon.MeituanDotnetSDK.api.common.request
{
    public abstract class BaseSignRequest : IAPIRequest
    {
        private string app_key;
        private string app_secret;
        private SignMethodEnum sign_method = SignMethodEnum.SHA1;
        private DateTime timestamp = DateTime.Now;
        private string format = "json";
        private string v = "1";
        public abstract Dictionary<string, object> toParams();

        public BaseSignRequest()
        {
        }

        public BaseSignRequest(string app_key, string app_secret)
        {
            if (string.IsNullOrWhiteSpace(app_key))
            {
                throw new ArgumentNullException(app_key, "App key can't be empty");
            }
            if (string.IsNullOrWhiteSpace(app_secret))
            {
                throw new ArgumentNullException(app_key, "App secret can't be empty");
            }
            this.app_key = app_key;
            this.app_secret = app_secret;
        }

        public string APPKey
        {
            get
            {
                return app_key;
            }
        }
        public string APPSecret
        {
            get
            {
                return app_secret;
            }
        }
        public SignMethodEnum SignMethod
        {
            get
            {
                return sign_method;
            }
        }
        public DateTime TimeStamp
        {
            get
            {
                return timestamp;
            }
        }
        public string Format
        {
            get
            {
                return format;
            }
        }
        public string V
        {
            get
            {
                return v;
            }
        }

    }
}
